import request from '@/utils/request'

// 查询报关单管理列表
export function listDeclaration(query) {
  return request({
    url: '/fiscale/declaration/list',
    method: 'get',
    params: query
  })
}

// 查询报关单管理详细
export function getDeclaration(declarationId) {
  return request({
    url: '/fiscale/declaration/' + declarationId,
    method: 'get'
  })
}

// 新增报关单管理
export function addDeclaration(data) {
  return request({
    url: '/fiscale/declaration',
    method: 'post',
    data: data
  })
}

// 修改报关单管理
export function updateDeclaration(data) {
  return request({
    url: '/fiscale/declaration',
    method: 'put',
    data: data
  })
}

// 删除报关单管理
export function delDeclaration(declarationIds) {
  return request({
    url: '/fiscale/declaration/' + declarationIds,
    method: 'delete'
  })
}

// 根据报关单号查询报关单
export function getDeclarationByNo(declarationNo) {
  return request({
    url: '/fiscale/declaration/getByDeclarationNo/' + declarationNo,
    method: 'get'
  })
}

// 生成报关单号
export function generateDeclarationNo() {
  return request({
    url: '/fiscale/declaration/generateDeclarationNo',
    method: 'get'
  })
}

// 从订单创建报关单
export function createDeclarationFromOrders(data) {
  return request({
    url: '/fiscale/declaration/createFromOrders',
    method: 'post',
    data: data
  })
}

// 提交报关单
export function submitDeclaration(declarationId) {
  return request({
    url: '/fiscale/declaration/submit/' + declarationId,
    method: 'put'
  })
}

// 审批报关单
export function approveDeclaration(data) {
  return request({
    url: '/fiscale/declaration/approve',
    method: 'put',
    data: data
  })
}

// 批量更新报关单状态
export function batchUpdateDeclarationStatus(data) {
  return request({
    url: '/fiscale/declaration/batchUpdateStatus',
    method: 'put',
    data: data
  })
}